package com.sky.controller.user;

import com.sky.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

// 自定义Bean名称，防止注入时候类名重复
@RestController("userShopController")
@RequestMapping("/user/shop")
@Api(tags = "C端-店铺接口")
public class ShopController {
    public static final String KEY = "SHOP_STATUS";

    @Resource
    private RedisTemplate redisTemplate;

    @GetMapping("/status")
    @ApiOperation("获取店铺状态")
    public Result<Integer> getStatus() {
        Integer status = (Integer) redisTemplate.opsForValue().get(KEY);
        return Result.success(status);
    }
}
